package com.ayoka.parenting.adapter;

import android.widget.ImageView;

import com.ayoka.parenting.R;
import com.ayoka.parenting.bean.ChatMessageBean;
import com.jincp.common.brvah.BaseQuickAdapter;
import com.jincp.common.brvah.BaseViewHolder;
import com.jincp.image.load.ImageLoader;
import com.jincp.image.load.ImageLoaderOptions;


/**
 * @ProjectName: ayoka7.
 * @ClassName: MusicAdapter.
 * @Description: .
 * @Author: jincp.
 * @CreateDate: 2019/8/6 21:15.
 */

public class MessageAdapter extends BaseQuickAdapter<ChatMessageBean, BaseViewHolder> {

    public MessageAdapter() {
        super(R.layout.item_message, null);
    }

    @Override
    protected void convert(BaseViewHolder holder, ChatMessageBean item) {
        if (item.userBean != null) {
            ImageLoader.getInstance().displayImage(item.userBean.LocalAvatar, (ImageView) holder.getView(R.id.leftAvatar), ImageLoaderOptions.getCircleOptions());
            holder.setText(R.id.sender, item.userBean.WeixinNickName);
        }
        holder.setText(R.id.tv_message, item.message);
        holder.setVisible(R.id.tv_self, item.isChatToSelf);
    }
}
